﻿using Asptcp.Core;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Asptcp.Simple
{
    public class AspTcpHostService : BackgroundService
    {
        private AsptcpServer _asptcp;
        TestService _testService;
        public AspTcpHostService(AsptcpServer asptcpServer,TestService testService)
        {
            _asptcp = asptcpServer;
            _testService = testService;
        }
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _asptcp.Start();
            //while (!stoppingToken.IsCancellationRequested)
            //{
            //    _testService.Say("AspTcpHostService调用");
            //    await Task.Delay(1000);
            //}
        }
    }
}
